import React, { PureComponent } from 'react';
import { Card } from 'antd';
import moment from 'moment';
import StandardTable from '@/components/StandardTable';
import TextOverFlow from '../../components/TextOverFlow';

class EmpInfor extends PureComponent {
  jumpRouting = (targetRouter, id) => {
    const { jumpRouting } = this.props;
    jumpRouting(targetRouter, id);
  };

  render() {
    const { empInsCardInfo } = this.props;
    const columns = [
      {
        title: '办理状态',
        dataIndex: 'stateName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
      },
      {
        title: '客户名称',
        dataIndex: 'custName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
        render: text => <TextOverFlow text={text} />,
      },
      {
        title: '执行地',
        dataIndex: 'areaName',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
      },
      {
        title: '所属客服',
        dataIndex: 'blngCs',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder' } }),
      },
      {
        title: '操作时间',
        dataIndex: 'operTime',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder', textAlign: 'center' } }),
        onCell: () => ({ style: { textAlign: 'center' } }),
        render: val => (val ? moment(val).format('YYYY-MM-DD HH:mm') : '--'),
      },
      {
        title: '操作',
        dataIndex: 'n11',
        onHeaderCell: () => ({ style: { fontWeight: 'bolder', width: 150 } }),
        render: (text, record) => (
          <span
            style={{ color: '#1890FF', cursor: 'pointer' }}
            onClick={() => this.jumpRouting('insCardHdlId', record.insCardHdlId)}
          >
            查看
          </span>
        ),
      },
    ];
    return (
      <div>
        <Card
          id="socialCardInfor"
          title={<span>社保卡办理</span>}
          extra={<a onClick={() => this.jumpRouting('insCardHdlId')}>更多&gt;&gt;</a>}
        >
          <StandardTable
            selectedRows={[]}
            selectedRowKeys={[]}
            pagination={false}
            data={empInsCardInfo}
            rowSelection={null}
            columns={columns}
            rowKey="insCardHdlId"
            onSelectRow={this.handleSelectRows}
            onChange={this.handleStandardTableChange}
          />
        </Card>
      </div>
    );
  }
}

export default EmpInfor;
